/**
 * 
 */
package net.wisos.opn.common.entity;

import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import net.wisos.opn.cms.entity.Channel;
import net.wisos.opn.entity.BaseEntity;

/**
 * @author Liuye
 * 
 * 
 */
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class Category extends BaseEntity {
	private String name;

	private Channel parent;

	private int displayOrder = 50;

	/**
	 * @return the name
	 */
	@Column(length = 32, nullable = false, unique = true)
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the displayOrder
	 */
	public int getDisplayOrder() {
		return displayOrder;
	}

	/**
	 * @param displayOrder
	 *            the displayOrder to set
	 */
	public void setDisplayOrder(int displayOrder) {
		this.displayOrder = displayOrder;
	}

	/**
	 * @return the parent
	 */
	@ManyToOne
	@JoinColumn(name = "parent_id")
	@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
	public Channel getParent() {
		return parent;
	}

	/**
	 * @param parent
	 *            the parent to set
	 */
	public void setParent(Channel parent) {
		this.parent = parent;
	}
}
